<template>
  <div id="list" > 

     <div class="demo" :style="{  height: dtheight + 'px' }"  v-loading.lock="isshow">
      
     <div v-if="!isshow">
            <el-form ref="form"  label-width="80px">  
                <el-row> 
                    <el-col :span="18" style="display:flex;">
                        <el-form-item label="" label-width="0px">
                                <el-select   v-model="search_form.select_num" placeholder="请选择运营中心" style="width:160px;">
                                    <el-option  v-for="(item,index) in search_form.select_data" :key="index" :label="item.name + item.telphone" :value="item.ctid"></el-option>
                                </el-select>
                        </el-form-item>

                        <div class="custom_button2"  style="margin-left:10px;" @click="search_but1()"></div>

                        <el-form-item label="" style="margin-left:5px;" label-width="0px">
                            <el-select  v-model="search_form.select_td_num" placeholder="请选择团队" style="width:150px;">
                                <el-option  v-for="(item,index) in search_form.select_td_data" :key="index" :label="item.telphone" :value="item.uid" ></el-option>
                            </el-select>
                        </el-form-item>

                      <div class="custom_button2"  style="margin-left:10px;" @click="search_but2()"></div>
                    </el-col>

                    <el-col :span="6" style="text-align: right;">  
                        <el-button type="primary" class="custom_color_button" style="margin-bottom:10px;" @click="refresh_but()">刷新</el-button>            
                    </el-col>
                </el-row> 
              </el-form>
              
              <modular1 :ishave="ishave" :datalist="datalist"  :jfandhdlist="jfandhdlist"> </modular1>
              

              <div class="top" style="margin-top:20px;">
                  <div class="top_item" style="flex: 1;">
                      <img class="top_img" src="@/assets/images/echarts_tb11.png" />
                        蜂巢情况
                  </div> 
              </div>
              
              <modular2 :datalist="datalist" @up_list_fun="list_fun" > </modular2>

      </div>

   </div>



   </div>
</template>

<script>
import modular1 from '@/view/Operationdata/Analysis/modular1'
import modular2 from '@/view/Operationdata/Analysis/modular2'
export default {
   name: 'list',
  data () {
    return {
        dtheight:'500',  //窗口高度
        search_form:{
            select_num:'',
            select_data:[],
            select_td_num:'',
            select_td_data:[]
        },
        type:0, //0-查所有 1-运营中心 2-团队长
        datalist:[],
        jfandhdlist:[],
        isshow:false,
        ishave:false
    }
  },
   components:{
     modular1,
     modular2
  },
  created(){
     this.dtheight = window.innerHeight - 200
     this.td_list()
     this.yy_list()
     this.list_fun()
     this.jfandhd_fun()
  },
  mounted (){
    
  },
  methods: {
      td_list(){
        this.post("/blend/listOfTeam", {    
	        }).then(res => {
            this.search_form.select_td_data = res.result       
            //console.log(res)
         })
     },
     yy_list(){
        this.post("/blend/listOfCenter", {    
	        }).then(res => {
            this.search_form.select_data = res.result       
            //console.log(res)
         })
     },
     list_fun(){
       this.post("/blend/statistics", {  
            type:this.type, 
            ctid:this.search_form.select_num,
            team_uid:this.search_form.select_td_num
	        }).then(res => {
            this.datalist = res.result
            console.log(res.result,"aaaa")
         })

     },
     jfandhd_fun(){
       this.post("/blend/jfAndHd", {  
            type:this.type, 
            ctid:this.search_form.select_num,
            team_uid:this.search_form.select_td_num
	        }).then(res => {
            this.jfandhdlist = res.result
            //console.log(res.result,"bbbbbb")
         })
     },
     search_but1(){
        //console.log(this.search_form.select_num)
        if(this.search_form.select_num != ''){
            this.type = 1
            this.search_form.select_td_num = ''
            this.ishave = true
            this.list_fun()
            this.jfandhd_fun()
        }else{
             this.open1('请选择运营中心','warning')
        }

     },
     search_but2(){
        //console.log(this.search_form.select_td_num)
        if(this.search_form.select_td_num != ''){
            this.type = 2
            this.search_form.select_num = ''
            this.ishave = true
            this.list_fun()
            this.jfandhd_fun()

        }else{
             this.open1('请选择团队','warning')
        }
       
     },
     refresh_but(){
       this.type = 0
       this.search_form.select_td_num = ''
       this.search_form.select_num = ''
       this.ishave = false
       this.list_fun()
       this.jfandhd_fun()
     }
  }
}
</script>


<style scoped>
.demo{
    overflow-y:auto;
}

.top{
    display: flex;
}
.top_item{
    
    display: flex;
    align-items: center;
}
.top_img{
    width: 30px;
    height: 30px;
    margin-right: 10px;
}

</style>